<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        // 写一个函数，能返回传入的任意两个数字的最大值
        function getMax(a, b) {
            if (a > b) {
                return a;
            } else {
                return b;
            }
        }
        console.log(getMax(10, 30));

        // 翻转
        function tnt(arr) {
            var newArr = [];
            for (var i = arr.length - 1; i >= 0; i--) {
                newArr.push(arr[i]);
            }
            return newArr;
        }
        console.log(tnt([23, 445, 13, 4, 5, 6, 0]));



        // 冒泡
        function lyw(...arr1) {
            for (var i = 0; i < arr1.length - 1; i++) {
                for (var j = 0; j < arr1.length - i - 1; j++) {
                    if (arr1[j] > arr1[j + 1]) {
                        [arr1[j], arr1[j + 1]] = [arr1[j + 1], arr1[j]];
                    }
                }
            }
            return arr1;
        }
        console.log(lyw(4, 3, 6, 9, 2));

    </script>
</head>

<body>

</body>

</html>